home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Draw / App.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-20  |  7.1 KB  |  280 lines  |  [TEXT/MPS ]

  1. #ifndef __APPHEADER__
  2. #define __APPHEADER__
  3.  
  4. #ifndef __DTSLib__
  5. #include "DTS.Lib.h"
  6. #endif
  7.  
  8. #ifndef __PRINTING__
  9. #include <Printing.h>
  10. #endif
  11.  
  12. #ifndef __TREEOBJ__
  13. #include <TreeObj.h>
  14. #endif
  15.  
  16. /********/
  17.  
  18. #define VH_VERSION  1                /* True means to include ViewHierarchy window.             */
  19. #define DEV_VERSION 1                /* True means allow option-cmd.period escape from dialogs. */
  20.  
  21. /* If you are unfamiliar with programming with the DTS.framework, you probably want to
  22. ** read the file "=How to write your app", which is found at the same level as the
  23. ** directory for this project. */
  24.  
  25. #ifdef powerc
  26. #pragma options align=mac68k
  27. #endif
  28. typedef struct {
  29.     DocHeaderInfo    fhInfo;        /* Doc header info (version, print record, window loc. ) */
  30.     TreeObjHndl        root;
  31.                                 /***** Start of custom file info. *****/
  32. } TheDoc;
  33. #ifdef powerc
  34. #pragma options align=reset
  35. #endif
  36.  
  37. /* Below is the master document structure.  All DTS.framework documents use this structure.
  38. ** For each unique document type, union in a sub-structure for the document-specific
  39. ** information.  In the case of DTS.Chat, there is only one document type.  The structure for
  40. ** this document type is defined just above.  Even though there is only one, it is still
  41. ** placed in a union.  This allows easy addition of additional document types later.
  42. ** Given a FileRec handle called frHndl, a sample dereference to the inBox field would look like:
  43. **     inBox = (*frHndl)->d.doc.inBox;
  44. **
  45. ** The fileState and connect fields are expected and managed by DTS.framework.  Also, the
  46. ** first two fields in the app-specific portion of the document are expected, namely
  47. ** the fhInfo and root fields. */
  48.  
  49. #ifdef powerc
  50. #pragma options align=mac68k
  51. #endif
  52. typedef struct FileRec {
  53.     FileStateRec    fileState;        /* DTS.Lib expects this structure here. */
  54.     ConnectRec        connect;        /* DTS.Lib expects this structure here. */
  55.     union {
  56.         TheDoc    doc;                /* Union in each document type here. */
  57.     } d;
  58. } FileRec;
  59. #ifdef powerc
  60. #pragma options align=reset
  61. #endif
  62.  
  63. /* Below is the definition of the hierarchical document's root object.  If you are using
  64. ** the hierarchical document package TreeObj, then you will need at least this object.
  65. ** TreeObj expects the first two fields to be undo and frHndl, as shown below.  You can
  66. ** add fields after these two fields.  If you use TreeObj, the root object and all of its
  67. ** children are automatically saved and read from disk.
  68. ** Note that the definition for the root object includes a prototype.  Each object is
  69. ** automatically called by DTS.LIB..framework at appropriate times.  The prototype defines the
  70. ** function that will be called for this object.  See the files "=How to write your app"
  71. ** and "=Using TreeObj.c" for more information. */
  72.  
  73. #ifdef powerc
  74. #pragma options align=mac68k
  75. #endif
  76. long    TRootObj(TreeObjHndl hndl, short message, long data);
  77. typedef struct {
  78.     TreeObjHndl    undo;        /* This structure may be added to, but */
  79.     FileRecHndl    frHndl;        /* these two first fields must remain. */
  80.     short        numSelected;
  81. } RootObj;
  82. #ifdef powerc
  83. #pragma options align=reset
  84. #endif
  85.  
  86. /* This definition allows us to access the fields that are in common between the below objects. */
  87.  
  88. #ifdef powerc
  89. #pragma options align=mac68k
  90. #endif
  91. typedef struct {
  92.     Boolean        selected;
  93.     Rect        rect;
  94.     short        penHeight;
  95.     short        penWidth;
  96.     RGBColor    borderColor;
  97.     Boolean        content;
  98.     RGBColor    contentColor;
  99. } CommonObj;
  100. #ifdef powerc
  101. #pragma options align=reset
  102. #endif
  103.  
  104.  
  105. /* Below are the definitions of the various DTS.Draw tool palette objects. */
  106.  
  107. #ifdef powerc
  108. #pragma options align=mac68k
  109. #endif
  110. long    TRectObj(TreeObjHndl hndl, short message, long data);
  111. typedef struct {
  112.     Boolean        selected;
  113.     Rect        rect;
  114.     short        penHeight;
  115.     short        penWidth;
  116.     RGBColor    borderColor;
  117.     Boolean        content;
  118.     RGBColor    contentColor;
  119. } RectObj;
  120. #ifdef powerc
  121. #pragma options align=reset
  122. #endif
  123.  
  124.  
  125. #ifdef powerc
  126. #pragma options align=mac68k
  127. #endif
  128. long    TRRectObj(TreeObjHndl hndl, short message, long data);
  129. typedef struct {
  130.     Boolean        selected;
  131.     Rect        rect;
  132.     short        penHeight;
  133.     short        penWidth;
  134.     RGBColor    borderColor;
  135.     Boolean        content;
  136.     RGBColor    contentColor;
  137.     short        width, height;
  138. } RRectObj;
  139. #ifdef powerc
  140. #pragma options align=reset
  141. #endif
  142.  
  143.  
  144. #ifdef powerc
  145. #pragma options align=mac68k
  146. #endif
  147. long    TOvalObj(TreeObjHndl hndl, short message, long data);
  148. typedef struct {
  149.     Boolean        selected;
  150.     Rect        oval;
  151.     short        penHeight;
  152.     short        penWidth;
  153.     RGBColor    borderColor;
  154.     Boolean        content;
  155.     RGBColor    contentColor;
  156. } OvalObj;
  157. #ifdef powerc
  158. #pragma options align=reset
  159. #endif
  160.  
  161.  
  162. #ifdef powerc
  163. #pragma options align=mac68k
  164. #endif
  165. OSErr    CalcPiePoints(TreeObjHndl hndl);
  166. long    TPieObj(TreeObjHndl hndl, short message, long data);
  167. typedef struct {
  168.     Boolean        selected;
  169.     Rect        arc;
  170.     short        penHeight;
  171.     short        penWidth;
  172.     RGBColor    borderColor;
  173.     Boolean        content;
  174.     RGBColor    contentColor;
  175.     short        arcStart;
  176.     short        arcLength;
  177.     Point        center;
  178.     Point        arcBegin;
  179.     Point        arcEnd;
  180. } PieObj;
  181. #ifdef powerc
  182. #pragma options align=reset
  183. #endif
  184.  
  185.  
  186. #ifdef powerc
  187. #pragma options align=mac68k
  188. #endif
  189. long    TLineObj(TreeObjHndl hndl, short message, long data);
  190. typedef struct {
  191.     Boolean        selected;
  192.     Rect        rect;
  193.     short        penHeight;
  194.     short        penWidth;
  195.     RGBColor    borderColor;
  196.     Boolean        content;
  197.     RGBColor    contentColor;
  198.     short        flip;
  199. } LineObj;
  200. #ifdef powerc
  201. #pragma options align=reset
  202. #endif
  203.  
  204.  
  205. #ifdef powerc
  206. #pragma options align=mac68k
  207. #endif
  208. long    TGroupObj(TreeObjHndl hndl, short message, long data);
  209. typedef struct {
  210.     Boolean    selected;
  211.     Rect    group;
  212. } GroupObj;
  213. #ifdef powerc
  214. #pragma options align=reset
  215. #endif
  216.  
  217.  
  218. #ifdef powerc
  219. #pragma options align=mac68k
  220. #endif
  221. long    TExtSelectObj(TreeObjHndl hndl, short message, long data);
  222. typedef struct {
  223.     Boolean    selected;
  224.     Rect    selectArea;
  225. } ExtSelectObj;
  226. #ifdef powerc
  227. #pragma options align=reset
  228. #endif
  229.  
  230.  
  231. #define VFLIPOBJ 0x01
  232. #define HFLIPOBJ 0x02
  233.  
  234.  
  235. /* Here are some macro definitions to make dereferencing document objects easier. */
  236.  
  237. #define mDerefRoot(hndl)      ((RootObj*)((*hndl) + 1))
  238. #define mDerefCommon(hndl)    ((CommonObj*)((*hndl) + 1))
  239. #define mDerefRect(hndl)      ((RectObj*)((*hndl) + 1))
  240. #define mDerefRRect(hndl)     ((RRectObj*)((*hndl) + 1))
  241. #define mDerefOval(hndl)      ((OvalObj*)((*hndl) + 1))
  242. #define mDerefPie(hndl)       ((PieObj*)((*hndl) + 1))
  243. #define mDerefLine(hndl)      ((LineObj*)((*hndl) + 1))
  244. #define mDerefGroup(hndl)     ((GroupObj*)((*hndl) + 1))
  245. #define mDerefExtSelect(hndl) ((ExtSelectObj*)((*hndl) + 1))
  246.  
  247.  
  248. /********/
  249.  
  250. #define kMaxNumUndos    64
  251. #define kNumSaveUndos    8
  252.  
  253. #define RECTOBJ            16
  254. #define RRECTOBJ        17
  255. #define OVALOBJ            18
  256. #define PIEOBJ            19
  257. #define LINEOBJ            20
  258. #define GROUPOBJ        65
  259. #define EXTSELECTOBJ    66
  260.  
  261. #define kNumTreeObjs    67        /* Minimum number of objects is 16. */
  262.  
  263.  
  264. /********/
  265.  
  266. /* These values are passed to the DTS.LIB..framework function Initialize(). */
  267. #define kMinHeap    64 * 1024        /* Needs at least 64k of heap space. */
  268. #define kMinSpace    64 * 1024        /* Needs this much after calling PurgeSpace. */
  269.  
  270.  
  271. #define kwAppWindow    (kwGrowIcon | kwHScrollLessGrow | kwVScrollLessGrow | kwVisible | kwOpenAtOldLoc)
  272.  
  273. #define kVersion        101        /* Document versions, not application versions. */
  274. #define kMinVersion        100
  275. #define kMaxVersion        101
  276.  
  277. #define kMaxNumWindows        65535        /* No limit on the number of windows. */
  278.  
  279. #endif
  280.